﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Sino.CapacityCloud.Services
{

    public interface ITokenGenertationService
    {

        TimeSpan Expire { get; set; }

        /// <summary>
        /// Generate a token right now.
        /// </summary>
        /// <returns></returns>
        Task<string> GenerateAsync();

        /// <summary>
        /// Generate a token with the given creation time.
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        Task<string> GenerateAsync(DateTime time);

        Task<string> GenerateAsync(DateTime time, string oldToken);

        Task<bool> ValidateAsync(string token);

        Task<DateTime> ParseCreationTimeAsync(string token);

    }

}